/*
 * @Author: NJ_1098 xiabaoxin
 * @Date: 2025-02-12 09:46:54
 * @LastEditors: NJ_1098 xiabaoxin
 * @LastEditTime: 2025-02-13 09:15:45
 * @Description: 路由集合
 */
const compose = require("koa-compose");
const glob = require("glob");
const { resolve } = require("path");

routers = () => {
  let routers = [];
  glob
    .sync(resolve(__dirname, "./", "**/*.js"))
    .filter((value) => value.indexOf("index.js") === -1)
    .map((router) => {
      routers.push(require(router).routes());
    });
  return compose(routers);
};

module.exports = routers;